package com.wxy.事务管理注解;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

@Component("userDao")
public class userDaoImpl implements userDao{
	@Autowired
	private JdbcTemplate jdbcTemplate;
	@Override
	@Transactional
	public void update(String outUser,String inUser,int money) {
		// TODO 自动生成的方法存根
		this.jdbcTemplate.update
		("update bank set money=money-? where name=?",money,outUser);
		//int num=1/0;
		this.jdbcTemplate.update
		("update bank set money=money+? where name=?",money,inUser);
	}
}
